<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Twitter extends CI_Controller {

	public function index() {
		$twitter_user = 'mangkibo';
		$jsonpath 	= "http://api.twitter.com/1/statuses/user_timeline/".$twitter_user.".json";
		$decode 	= file_get_contents($jsonpath);
		$string 	= json_decode($decode);
		
		foreach ($string as $status) {
			echo"<br>Tweet: ". $status->text;
			echo"<br>date:".$status->created_at."<br>";
		}
		//$xml = simplexml_load_file($xmlpath);
		//$count_tweet = sizeof($xml);
		//$data['xml'] =  simplexml_load_file($xmlpath);
		
		/*for($i=0 ; $i < $count_tweet  ; $i++)
		{
				echo"<br>Tweet: ". $xml->status[$i]->text;
				echo"<br>date:".$xml->status[$i]->created_at."<br>";
		}*/
	}
}